package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 文件的赋值
 */
public class CopyDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("image.png");
        FileOutputStream fos = new FileOutputStream("image_cp2.jpg");

        /*
            image内容
            00000001 00010001 00000111 00010001
         */
        int d;
        long start = System.currentTimeMillis();
        while((d = fis.read()) != -1){

            fos.write(d);
        }

        long end = System.currentTimeMillis();
        System.out.println("复制完成耗时：" + (end - start) / 1000);
        fis.close();
        fos.close();



    }
}
